//
//  Bundle+Extension.swift
//  YangFoundation
//
//  Created by yuyang on 2021/12/21.
//

import UIKit

extension Bundle {

    /// 访问pod库bundle快捷方式
    ///
    /// - Parameters:
    ///   - clas: pod 库中类
    ///   - resource: 资源 resource_bundles 中的 key
    /// - Returns: Bundle?
    public static func `init`(_ clas: AnyClass, resource: String?) -> Bundle? {
        let frameworkBundle = Bundle(for: clas)
        guard let bundleURL = frameworkBundle.url(forResource: resource, withExtension: "bundle") else { return nil }
        return Bundle(url: bundleURL)
    }
}
